Passed
Push — renovate/moment-timezone-0.x ( 1820eb )
by
unknown
04:59
created

MiniRanking   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 35
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3
1
import React, { Component } from "react"
2
3
class MiniRanking extends Component {
4
  render() {
5
    if (this.props.ranking.length <= 0) {
6
      return <span>Nog geen klassement opgemaakt</span>
7
    }
8
9
    this.props.ranking.sort((a, b) => {
10
      return a && a.position - b.position
11
    })
12
13
    return (
14
      <table>
15
        <thead>
16
          <tr>
17
            <th>#</th>
18
            <th>Team</th>
19
            <th>Pts</th>
20
          </tr>
21
        </thead>
22
        <tbody>
23
          {this.props.ranking.map((rank, i) => {
24
            return (
25
              rank && (
26
                <tr key={i}>
27
                  <td>{rank.position}</td>
28
                  <td
29
                    className={
30
                      rank.team.includes("Elewijt")
31
                        ? "team-ranking__winner"
32
                        : undefined
33
                    }
34
                  >
35
                    {rank.team}
36
                  </td>
37
                  <td>{rank.points}</td>
38
                </tr>
39
              )
40
            )
41
          })}
42
        </tbody>
43
      </table>
44
    )
45
  }
46
}
47
48
export default MiniRanking
49